-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement when/then/otherwise for DuckDB #1759
Conversation
4e9ec8b
to
89c8b1e
Compare
84f3296
to
8b663da
Compare
tpch/execute.py
Outdated
"dask": lambda x: x.compute(), | ||
} | ||
|
||
DUCKDB_XFAILS = [11, 14, 15, 16, 18, 22] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
16 out of the 22 queries already work with duckdb π±
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -157,6 +158,16 @@ def func(df: DuckDBLazyFrame) -> list[duckdb.Expression]: | |||
kwargs={"exprs": exprs}, | |||
) | |||
|
|||
def when( | |||
self, | |||
*predicates: IntoDuckDBExpr, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*predicates: IntoDuckDBExpr, | |
*predicates: IntoDuckDBExpr |
trailing comma π± (just joking. I love the other PRs π )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok this made me laugh out loud π
*predicates: IntoDuckDBExpr, | ||
) -> DuckDBWhen: | ||
plx = self.__class__(backend_version=self._backend_version, version=self._version) | ||
condition = plx.all_horizontal(*predicates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
condition = plx.all_horizontal(*predicates) | |
if predicates: | |
condition = plx.all_horizontal(*predicates) | |
else: | |
msg = "at least one predicate needs to be provided" | |
raise TypeError(msg) |
The other backends have this check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah i moved it up cause i was tired of rewriting it everywhere π #1756
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
finally i make a useful today
What type of PR is this? (check all applicable)
Related issues
Checklist
If you have comments or can explain your changes, please do so below